package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.service.IPraiseService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/praise")
public class PraiseController {

    @Autowired
    private IPraiseService praiseService;

    @GetMapping("/{userId}")
    public Object get(@PathVariable Long userId, Long typeId, Integer type){

        return praiseService.get(userId,typeId,type);

    }

    @PostMapping("/{userId}")
    public Object save(@PathVariable Long userId, Long typeId, Integer type){
        praiseService.save(userId,typeId,type);
        return new JSONResult();

    }


    /*标记已读*/
    @PostMapping()
    public Object setRead(Long id){
        praiseService.setRead(id);
        return new JSONResult();
    }


}
